let fs = require('fs')
let SSH = require('simple-ssh');
let info = JSON.parse(fs.readFileSync( __dirname + '/config.json', 'utf-8'))
let conns = info.conns
let probe = info.probe

conns.map(function(v) {
    var ssh = new SSH(v)
     ssh.exec(probe, {
        pty: true,
        out: function(stdout) {
             stdout !== '\r\n' &&
             stdout.replace(/\ +|\r|\n|\t/g, '') !=='' ? console.log(v.host + ":" + stdout) : ''
        }
     }).start();

})

if (require.main === module) {
    // console.log(conns)
}